﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace CloudReader.Text
{
    /// <summary>
    /// 为WPF应用提供QQ聊天系统的适配类
    /// </summary>
    public class MessageAdapter
    {
        WebBrowser _web;
        Window _w;
        /// <summary>
        /// 使用一个浏览器组件初始化
        /// </summary>
        /// <param name="web">wpf浏览器控件</param>
        /// <param name="w">web控件的所有者窗体</param>
        public MessageAdapter(WebBrowser web,Window w)
        {
            _web = web;
            _w = w;
        }
        /// <summary>
        /// 发送或接收消息
        /// </summary>
        /// <param name="Content">消息内容</param>
        /// <param name="Response">指定是否为接收标识</param>
        public void SendMessage(string Content, bool Response)
        {
            _web.InvokeScript("Message", new object[] { Content, Response });
        }
    }
}
